<template>
    <a-card :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
            <a-form layout="inline" @keyup.enter.native="searchQuery">
                <a-row :gutter="24">
                    <a-col :span="5">
                        <a-form-model-item label="门店名称">
                            <a-select :allowClear="true" v-model="queryParam.merchantId">
                                <a-select-option v-for="(item, index) in storeList" :key="index" :value="item.id">{{ item.storeName }}</a-select-option>
                            </a-select>
                        </a-form-model-item>
                    </a-col>
                    <a-col :span="6">
                        <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                            <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                            <a-button type="primary" @click="searchReset" icon="reload"
                                style="margin-left: 8px">重置</a-button>
                        </span>
                    </a-col>
                </a-row>
            </a-form>
        </div>
        <div>
            <a-table ref="table" size="middle" :scroll="{ x: true }" :bordered="false" rowKey="id" :columns="columns"
                :dataSource="dataSource" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap"
                @change="handleTableChange">
            </a-table>
        </div>
    </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, postAction } from '@api/manage'
import siteCommissionSetModal from './modules/siteCommissionSet.vue'

export default {
    name: 'SiteCommissionList',
    mixins: [JeecgListMixin, mixinDevice],
    components: { siteCommissionSetModal },
    data() {
        return {
            description: '企业',
            // 表头
            columns: [
                {
                    title: '商户名称',
                    align: "center",
                    dataIndex: 'merchantName',
                },
                {
                    title: '订单类型',
                    align: "left",
                    dataIndex: 'type',
                    customRender: (text, record, index) => {
                        return text == 0 ? '个人单' : '企业单';
                    }
                },
                {
                    title: '企业名称',
                    align: "left",
                    dataIndex: 'companyName',
                },
                {
                    title: '打印时间',
                    align: "left",
                    dataIndex: 'createTime',
                }
            ],
            url: {
                list: "hc/hcMerchantOrderPrintLog/list",
            },
            dictOptions: {},
            superFieldList: [],
            baseUrl: '',
            storeList: [],
        }
    },
    mounted() {
        this.getStoreList()
    },
    methods: {
        //获取所有门店列表
        async getStoreList() {
            // let res = await getAction('hc/hcMerchant/list', { pageNo: 1, pageSize: -1 })
            let res = await getAction('hc/hcMerchant/merchantList', { pageNo: 1, pageSize: -1 })
            console.log('res', res)
            this.storeList = res.result.records
        },
    }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>